cmake_minimum_required(VERSION 3.10)
project(MyQtProject VERSION 1.0.0)

# 设置自动处理UI、MOC和资源文件
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

# 设置C++标准
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 强制设为调试模式‌，否则无法断点调试
set(CMAKE_BUILD_TYPE Debug)

# 查找Qt5组件
find_package(Qt5 COMPONENTS Widgets REQUIRED)

# 收集源文件和UI文件
file(GLOB SOURCES "*.cpp")
file(GLOB UI_FILES "*.ui")  # 添加所有UI文件

# 添加可执行文件
add_executable(MyQtProject ${SOURCES} ${UI_FILES})

# 链接Qt库
target_link_libraries(MyQtProject Qt5::Widgets)
